#!/bin/bash
set -euo pipefail
BaseDir=$(cd "$(dirname "$0")"; pwd)
cd ${BaseDir}

# 创建一个名为 venv 的虚拟环境目录。
[ -d ./venv ] || python3 -m venv venv

source ./venv/Scripts/activate
# venv\Scripts\activate

echo "依赖包的检查和准备..."
grep 'aliyun' $HOME/pip/pip.conf || {
    echo "pip的镜像设置"
    cat <<EOF > $HOME/pip/pip.conf 
[global]
index-url = https://mirrors.aliyun.com/pypi/simple

[install]
trusted-host = mirrors.aliyun.com
EOF
}
pip show streamlit || pip install -r requirements.txt

echo "启动...[CTRL+C退出]"
streamlit run nebulagraph-gephi-exchange.py --server.port 8501 --theme.base dark

# http://localhost:8501/ 中连接 localhost:9669 nebula服务
# 使用vscode加载 .vscode\launch.json 可以直接调试nebulagraph-gephi-exchange.py
